let fn = async ({ data, dist }, { socket, io, reg, user }, topic) => {
    let t = reg.users.find({name: dist})
    await reg.dao.newMessage(dist, user.name, data)
    let msg = {
        sender: user.toSender(),
        data
    }
    t.socket.emit(topic, msg)
    socket.emit(topic, msg)
}

module.exports = fn